<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,minimum-scale=1, user-scalable=no">
		<title>数组扩展</title>
		<script type="text/javascript">
		let arr = [1,2,5,-10,0,-20]
		//1、entries() [key,value]的集合
		let entries = arr.entries()
		for (let item of entries){
			//[0,1],[1,2],[2,5]...[5,-20]
			//console.log(item)
		}
		//2、keys():数组的index
		let keys = arr.keys()
		for(let item of keys) {
			//0 1 2 3 4 5
			//console.log(item)
		}
		//3、values():数组的值
		let values = arr.values()
		for (let item of values){
			//console.log(item)
		}
		//对象的遍历
		let person = {
			name:'tom',
			age:20,
			gender:'男'
		}
		//console.log(person)
		
		let obj = {}
		//属性和值的集合
		let entriesPerson = Object.entries(person)
		for (let item of entriesPerson){
			//console.log(person[item[0]])
		}
		//属性名称集合
		let keysPerson = Object.keys(person)
		for (let item of keysPerson){
			//console.log(item)
		}
		//属性值集合
		let valuesPerson = Object.values(person)
		for (let item of valuesPerson){
			console.log(item)
		}
		</script>
	</head>
	<body>
		<div id="app">
			<!-- todo -->
		</div>
	</body>
</html>